package adaoters;

import example.demo_navi.R;
import gui_View.UrlImageView;

import java.util.ArrayList;

import models.Listvid;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListvidAdapter extends BaseAdapter{

	private ArrayList<Listvid> al;
	private LayoutInflater linf;
	
	public ListvidAdapter(Context ct,ArrayList<Listvid> al1){
		this.al=al1;
		this.linf=LayoutInflater.from(ct);
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return al.size();
	}

	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return al.get(arg0);
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	public View getView(int pos, View v, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(v==null){
			v=linf.inflate(R.layout.list_item_user_video, null);
		}
		UrlImageView uiv=(UrlImageView) v.findViewById(R.id.userVideoThumbImageView);
		TextView tv=(TextView) v.findViewById(R.id.userVideoTitleTextView);
		final Listvid lv=al.get(pos);
		uiv.setImageDrawable(lv.getLithum());
		tv.setText(lv.getLiti());
		return v;
	}
	
}
